home *** CD-ROM | disk | FTP | other *** search
/ Garbo / Garbo.cdr / mac / hypercrd / hc2_x / tcprogud.sit / TC Prog Guide / card_37863.txt < prev    next >
Text File  |  1991-02-27  |  1KB  |  39 lines

  1. -- card: 37863 from stack: in
  2. -- bmap block id: 0
  3. -- flags: 0000
  4. -- background id: 4755
  5. -- name: 
  6.  
  7.  
  8. -- part contents for background part 4
  9. ----- text -----
  10. Let's redefine the Person class to be derived from the Generic_Class:
  11.  
  12.     struct Person:Generic_Class
  13.     {
  14.         int       age;
  15.         int       weight;
  16.  
  17.         void    set(void);         /* in C++ use 'virtual void set(void)' */
  18.         void    print(void);    /* in C++ use 'virtual void print(void)' */
  19.     };
  20.  
  21. Now both the Person and Student classes inherit the init() and destroy() methods.
  22.  
  23. To clarify program structure, ease code reusability, and speed up development (via separate compilation), it is customary to place the definition of each class in a separate header file* and to place the definitions for a given class' methods in a separate source file.  This will be demonstrated in the example at the end of the chapter.
  24.  
  25. -- part contents for background part 7
  26. ----- text -----
  27. 111
  28.  
  29. -- part contents for background part 29
  30. ----- text -----
  31. 52189
  32.  
  33. -- part contents for background part 27
  34. ----- text -----
  35. File inclusion
  36.  
  37. -- part contents for background part 20
  38. ----- text -----
  39. File inclusion - p175